package com.ihome.excel.xlsx.config;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import com.ihome.excel.xlsx.exceptions.ThrowableDefine;

public class DataMappingConfig {
    
    private static final String FILE_NAME = "/data-mapping.properties";

    private static Properties dataMapping = new Properties();
    
    static{        
        try {
            InputStream in = Thread.class.getClass().getResourceAsStream(FILE_NAME);
            dataMapping.load(in);            
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            throw ThrowableDefine.PROPERTIES_LOAD_ERROR.getPropertiesLoadExp(e.getMessage());
        } catch (IOException e) {
            e.printStackTrace();
            throw ThrowableDefine.PROPERTIES_LOAD_ERROR.getPropertiesLoadExp(e.getMessage());
        }
    }
    
    public static String getPropertyValue(String key){
        return dataMapping.getProperty(key);
    }  
}
